<template>
  <div class="container">
    <div class="up">
      <h2>合肥婚庆公司</h2>
      <span>婚庆公司提供婚礼布置、婚庆三大金刚、婚车等婚庆服务</span>
      <!-- <span>更多></span> -->
    </div>
    <div class="down">
      <div
        v-for="{ cid, cname, cpic, rates, minPrice } in data.data"
        :key="cid"
      >
        <img @click="goto(cid)" :src="`/companys/${cpic}`" alt="" />
        <div>
          <img src="../assets/img/181926.png" alt="" /><span
            @click="goto(cid)"
            >{{ cname }}</span
          >
        </div>
        <div>
          <img src="../assets/img/011182135.png" alt="" />
          <span>{{ rates }}条</span>
        </div>
        <span
          ><span>￥{{ minPrice }}</span
          >起</span
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      data: [],
    }
  },
  methods: {
    getData() {
      const url = "/companys/index"
      this.axios.get(url).then((res) => {
        // console.log(res)
        this.data = res.data
      })
    },
    goto(cid) {
      this.$router.push("/company?cid=" + cid)
    },
  },
  mounted() {
    this.getData()
  },
}
</script>

<style lang="scss" scoped>
.container {
  width: 1200px;
  margin: 30px auto;
  background-color: #fff;
  padding: 15px;
  .up {
    display: flex;
    align-items: center;
    margin-bottom: 13px;
    > span:nth-child(2) {
      flex: 1;
      font-size: 8px;
      margin-left: 18px;
    }
    // > span:last-child {
    //   font-size: 16px;
    // }
  }
  .down {
    display: flex;
    justify-content: space-between;
    > div {
      width: 19%;
      > img {
        width: 100%;
        cursor: pointer;
        &:hover {
          opacity: 0.8;
        }
      }
      > div:nth-child(2) {
        display: flex;
        align-items: center;
        font-size: 13px;
        margin-top: 10px;
        > img {
          width: 16px;
          margin-right: 8px;
        }
        > span {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          cursor: pointer;
          transition: 0.5s;
          &:hover {
            color: #e4464b;
          }
        }
      }
      > div:nth-child(3) {
        display: flex;
        align-items: center;
        margin: 4px 0;
        > img {
          height: 10px;
          margin-right: 10px;
        }
        > span {
          font-size: 10px;
        }
      }
      > span:last-child {
        font-size: 8px;
        display: flex;
        align-items: center;
        > span {
          font-size: 14px;
        }
      }
    }
  }
}
</style>
